<?php 
	session_start();
	include_once("./head.php");
	include_once("./commonality.php");
	date_default_timezone_set('PRC');
	//print_r($_POST);print_r($_GET);exit;
	if(isset($_GET['order_id'])){
		$order_id=$_GET['order_id'];
	}
	foreach ($_SESSION['cart'] as $value) {
	       		$pid=$_GET['pid'];
	       }      
		if(isset($_POST["sub"])){	
       $mcontent=$_POST['mcontent'];      
       $uid=$_SESSION['uid'];
       $time=date('Y-m-d h:i:s',time());
       $touxiang=$_SESSION['touxiang'];
       $comment=$_POST['criticize'];
       $sql="insert into message(comment,mcontent,mtime,uid,pid,tou)values('$comment','$mcontent','$time','$uid','$pid','$touxiang')";
       mysql_query($sql);
       if(mysql_affected_rows()>0){
       	echo"<script>alert('评论成功');location.href='show.php?pid={$pid}';</script>";
       }else{
       	//echo"<script>alert('评论失败')</script>";
       }

	}

 ?>
 <!DOCTYPE html>
 <html>
 <head>
 	<title>评论</title>
 </head>
 <style type="text/css">
	.ping{
		margin-left:420px;		
	}
	.close{
		width:160px;
		height:50px;
		background:#2894ff;
		display:inline-block;
		margin-top:30px;
		margin-left:100px;
		margin-right:100px;
		line-height:50px;
		text-align:center;
		color:white;
		font-size:20px;
		border-radius:4px;
	}

</style>
 <body>
 	<div class="ping">
 		<form action="./pinglun.php" method="POST" enctype="multipart/form-data">
 		<font color="red" size="5px">发表评论<br>
		<?php
			include_once("./fckeditor/fckeditor.php");
			$fckeditor = new FCKeditor("mcontent");//定义默认值 name
			$fckeditor->Width = "500px";//定义编辑器的宽度
			$fckeditor->Height = "200px";//定义编辑器的高度
			$fckeditor->Value = "";//定义默认值
			$fckeditor->BasePath='./fckeditor/';
			$fckeditor->ToolbarSet = "Basic";
			$fckeditor->Create();//创建编辑器
		?><br>
		<input type="radio" name="criticize" value="0" checked>好评
		<input type="radio" name="criticize" value="1">中评
		<input type="radio" name="criticize" value="2">差评
	</font>
		<input type="submit" name="sub" value="评价" class="close" />
		</form>
 	</div>
 </body>
 </html>